Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
14 lines (9 loc) · 485 Bytes

3.2.1 - Coroutine/Channel->__construct.md

File metadata and controls

14 lines (9 loc) · 485 Bytes

Coroutine\Channel->__construct

通道构造方法。

Coroutine\Channel->__construct(int $capacity = 1)
  • $capacity,设置容量,默认为1,必须为大于或等于1的整数
  • 底层使用PHP引用计数来保存变量,缓存区只需要占用 $capacity * sizeof(zval) 字节的内存
  • Server中使用时必须在onWorkerStart之后创建

PHP7版本下zval16字节,如$capacity = 1024时,Channel最大将占用16K内存